<?php
echo form::open('admin/seminarWizard/next', array('id'=>'wizardForm'));

echo '<h2>' . text::getEscaped('seminarWizard.mainProgramPriceTable') . '</h2>';
echo '<p class="description">' . text::getEscaped('seminarWizard.mainProgramPriceTable-desc') . '</h2>';

echo '<ul>';
foreach ($batchTypeList as $batchType) {
    echo '<li>';
    echo '<h4>' . $batchType['name'] . '</h4>';
    ?>
    <table class="pricesTable">
        <thead>
            <tr>
                <th></th>
                <?php
                foreach ($this->data->priceGroupList as $priceGroupIndex => $priceGroup) {
                    echo '<th>' . $priceGroup['name'] . ' - ' . $priceGroup['currency_code'] . '</th>';
                }
                ?>
            </tr>
        </thead>
        <tbody>
            <?php
            $rowNumber = 1;
            foreach ($this->data->availableAccomodationTypeList as $accomodationType) {
                if (! $this->isAccomodationTypeAvailableOnBatchType($accomodationType['code'], $batchType['code']) ) {
                    continue;
                }
                echo '<tr' . ($rowNumber % 2 == 1 ? ' class="oddRow"' : '') . '>';
                echo '<th>' . $accomodationType['name'] . '</th>';
                foreach ($this->data->priceGroupList as $priceGroupIndex => $priceGroup) {
                    echo '<td>';
                    echo form::decimal('accomodationTypePrice[' . $batchType['code'] . '][' . $accomodationType['code'] . '][' . $priceGroupIndex . ']',
                            $priceForm['accomodationTypePrice'][$batchType['code']][$accomodationType['code']][$priceGroupIndex]);
                    echo '</td>';
                }
                echo '</tr>';
                $rowNumber ++;
            }
            ?>
        </tbody>
    </table>
    <?php
    echo '</li>';
}
echo '</ul>';

// Prices of side programs (eg. anusthana)
echo '<h2>' . text::getEscaped('seminarWizard.sideProgram-title') . '</h2>';
echo '<ul>';
foreach ($this->data->availableProgramTypeList as $programType) {
    echo '<li>';
    echo '<em>' . $programType['name'] . '</em>';

	echo ' &ndash; <span class="description">' . $programType['description'] . '</span>';
	echo '<p><label>' . text::getEscaped('seminarWizard.price-amount') . ':' . form::integer('programTypePrice[' . $programType['code'] . ']', $priceForm['programTypePrice'][$programType['code']]) . ' %</label></p>';
    echo '</li>';
}
echo '</ul>';

// Single day, satsang and satsang-with-accomodation prices prices
if ($this->data->seminar['singleDaysAllowed']) {
	echo '<h3>' . text::getEscaped('seminarWizard-singleDayProgramPrices') . '</h3>';
	echo '<p class="description">' . text::getEscaped('seminarWizard-singleDayProgramPrices-desc') . '</p>';
	?>
    <table class="pricesTable">
        <thead>
            <tr>
                <th></th>
                <?php
                foreach ($this->data->priceGroupList as $priceGroupIndex => $priceGroup) {
                    echo '<th>' . $priceGroup['name'] . ' - ' . $priceGroup['currency_code'] . '</th>';
                }
                ?>
            </tr>
        </thead>
        <tbody>
            <?php
            $rowNumber = 1;
            foreach ($this->data->singleDayProgramTypeList as $programType) {
                if (! $programType['single_days_only']) {
                    continue;
                }
                echo '<tr' . ($rowNumber % 2 == 1 ? ' class="oddRow"' : '') . '>';
                echo '<th>' . $programType['name'] . '</th>';
                foreach ($this->data->priceGroupList as $priceGroupIndex => $priceGroup) {
                    echo '<td>';
                    echo form::decimal('singleDayProgramTypePrice[' . $programType['code'] . '][' . $priceGroupIndex . ']',
                            $priceForm['singleDayProgramTypePrice'][$programType['code']][$priceGroupIndex]);
                    echo '</td>';
                }
                echo '</tr>';
                $rowNumber ++;
            }
            ?>
        </tbody>
    </table>
    <?php 
}
?>

</form>

<script type="text/javascript">
    $(document).ready(function () {
        $('form input:first').focus();
    });
</script>